


Imports System.Data.SqlClient
Imports ModuloAdministraciondeEnvios.Entity
Imports ModuloAdministraciondeEnvios.BusinessLogicLayer


Namespace DataAccessLayer
    Public Class DataHistoriaEnvio

        Inherits HistoriaEnvio
        Implements IHistoriaEnvio

        Public Function AgregarHistoria(ByVal HistoriaEnvio As HistoriaEnvio) As Boolean Implements BusinessLogicLayer.IHistoriaEnvio.AgregarHistoria

            Try

                IdEnvio = HistoriaEnvio.IDEnvio
                Fecha = HistoriaEnvio.Fecha
                hora = HistoriaEnvio.Hora
                Estado = HistoriaEnvio.Estado
                Posicion = HistoriaEnvio.Posicion
                Pago = HistoriaEnvio.Pago
                Observacion = HistoriaEnvio.Observacion

                Dim Conecta As New SqlConnection(StringConecta)
                Conecta.Open()
                Comando = New SqlCommand(StringComando, Conecta)

                Comando.CommandText = "HistoriaEnvio_Insert"
                Comando.CommandType = CommandType.StoredProcedure

                Comando.Parameters.Add("@IdEnvio", SqlDbType.Int, 4, "IdEnvio").Value = IdEnvio
                Comando.Parameters.Add("@Fecha", SqlDbType.Date, 6, "Fecha").Value = Fecha
                Comando.Parameters.Add("@Hora", SqlDbType.Time, 8, "Hora").Value = Hora
                Comando.Parameters.Add("@Estado", SqlDbType.Int, 4, "Estado").Value = Estado
                Comando.Parameters.Add("@Posicion", SqlDbType.VarChar, 50, "Poscion").Value = Posicion
                Comando.Parameters.Add("@Pago", SqlDbType.Decimal, 9, "Pago").Value = Pago
                Comando.Parameters.Add("@Observacion", SqlDbType.VarChar, 50, "Observacion").Value = Observacion

                Comando.ExecuteNonQuery()
                Conecta.Close()

                MsgBox("Registro Grabado con Exito")


            Catch ex As Exception

                MsgBox(ex.Message)

            End Try



        End Function

        Public Function TraerHistoriaPorEnvio(ByVal n As Integer) As System.Data.DataSet Implements BusinessLogicLayer.IHistoriaEnvio.TraerHistoriaPorEnvio





        End Function

    End Class
End Namespace